var loginname = GetQueryString("loginname");
if (loginname == "") {
    //UIkit.modal.alert("用户名为空");
    window.location.href = "resetpwd1.html";
}

var email = sessionStorage.getItem(loginname + "email");
if (email == null) {
    window.location.href = "resetpwd1.html";
}

$("#email").text(email);
$(function () {

    $(".inputClass").blur(function () {
        var id = $(this).attr("id");//获取当前输入框的id  
        var funName = "validate" + id.substring(0, 1).toUpperCase() + id.substring(1) + "()";//得到对应的校验函数名  
        eval(funName);//执行函数调用  
    });

});

$("#btnValidate").click(function () {
    var bool = true;//表示校验通过  
    var code = $("#code").val();
    if (code == null || code == undefined || code == '') {
        UIkit.modal.alert("验证码不能为空！");
        return;
    }

    $.ajax({
        type: "GET",
        url: GetBaseUrl() + "/users/verification/" + loginname + "/" + code,
        dataType: "json",
        success: function (msg) {
            if (msg.code == 0) {
                sessionStorage.setItem("loginname", loginname);
                 sessionStorage.setItem(loginname+"code", code);
                window.location.href = "resetpwd3.html?loginname="+loginname;
            }
            else {
                UIkit.modal.alert(msg.msg);
            }
        }
    });

})